package com.xuecheng.content.api;

import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(value = "课程教师管理接口",tags = "课程教师管理接口")
public class CourseTeacherController {

    @Autowired
    CourseTeacherService courseTeacherService;

    //课程教师查询接口
    @ApiOperation("查询课程教师")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> getcourseTeacher(@PathVariable Long courseId){
        return courseTeacherService.getcourseTeacher(courseId);
    }

    //课程教师添加和修改接口
    @ApiOperation("添加和修改课程教师")
    @PostMapping("/courseTeacher")
    public CourseTeacher addAndupdatecourseTeacher(@RequestBody CourseTeacher courseTeacher){
            return courseTeacherService.addAndupdatecourseTeacher(courseTeacher);
    }

    //课程教师删除接口
    @ApiOperation("删除课程教师")
    @DeleteMapping("/courseTeacher/course/{courseId}/{Id}")
    public void deletecourseTeacher(@PathVariable Long courseId,@PathVariable Long Id) {
        courseTeacherService.deletecourseTeacher(courseId, Id);
    }
}
